import React, { PureComponent } from 'react';
import { Card } from 'antd';
import moment from 'moment';
import router from 'umi/router';
import StandardTable from '@/components/StandardTable';
import TextOverFlow from '../../components/TextOverFlow';

class EmpInfor extends PureComponent {
  jumpRouting = (targetRouter, id) => {
    const { jumpRouting } = this.props;
    jumpRouting(targetRouter, id);
  };

  render() {
    const { proServiceInfor } = this.props;
    const columns = [
      {
        title: '产品',
        dataIndex: 'assAndPdName',
        onHeaderCell: () => ({ style: { fontWeight: 'bolder' } }),
        render: text => <TextOverFlow text={text} />,
      },
      {
        title: '业务开始日期',
        dataIndex: 'beginDate',
        onHeaderCell: () => ({ style: { fontWeight: 'bolder' } }),
        render: val => (val ? moment(val).format('YYYY-MM-DD') : '--'),
      },
      {
        title: '业务结束日期',
        dataIndex: 'endDate',
        onHeaderCell: () => ({ style: { fontWeight: 'bolder', textAlign: 'center' } }),
        onCell: () => ({ style: { textAlign: 'center' } }),
        render: val => (val ? moment(val).format('YYYY-MM-DD') : '--'),
      },
      {
        title: '执行地',
        dataIndex: 'cityName',
        onHeaderCell: () => ({ style: { fontWeight: 'bolder' } }),
        render: val => val || '--',
      },
      {
        title: '申报工资',
        dataIndex: 'decWage',
        onHeaderCell: () => ({ style: { fontWeight: 'bolder' } }),
        render: val => val || '--',
      },
      {
        title: '缴费方式',
        dataIndex: 'payWayName',
        onHeaderCell: () => ({ style: { fontWeight: 'bolder' } }),
        render: val => val || '--',
      },
      {
        title: '缴费账户',
        dataIndex: 'accoName',
        onHeaderCell: () => ({ style: { fontWeight: 'bolder', textAlign: 'center' } }),
        onCell: () => ({ style: { textAlign: 'center' } }),
        render: val => val || '--',
      },
      {
        title: '政策组合',
        dataIndex: 'grpName',
        onHeaderCell: () => ({ style: { fontWeight: 'bolder', textAlign: 'center' } }),
        onCell: () => ({ style: { textAlign: 'center' } }),
        render: (text, record) => (
          <a
            onClick={() =>
              router.push(
                `/searchmanage/policysearch/${record.ass !== 2 ? 'detail' : 'foundDetail'}?${
                  record.ass !== 2 ? 'insLsPkgId' : 'accuLsPkgId'
                }=${record.grpId}&areaId=${record.cityId}`
              )
            }
          >
            {record.grpName || '--'}
          </a>
        ),
      },
    ];
    return (
      <div>
        <Card title={<span>产品服务信息</span>} id="proserviceinfor">
          <StandardTable
            selectedRows={[]}
            selectedRowKeys={[]}
            rowSelection={null}
            pagination={false}
            data={proServiceInfor}
            columns={columns}
            rowKey="pdId"
            onSelectRow={this.handleSelectRows}
            onChange={this.handleStandardTableChange}
          />
        </Card>
      </div>
    );
  }
}

export default EmpInfor;
